<template>
  <div class="wx_content_check">
    微博微博

  </div>
</template>
<script>
  import {mapActions, mapState} from 'vuex'
  import config from '@/config/env'
  export default {
    data () {
      return {
        wd: '',
        attrId: null,
        sourceType: 1,
        authStatus: null,
        page: 1,
        size: 10,
        reason: null,
        dialogShow: false,
        tbLoading: false
      }
    },
    mounted () {
      this.initPage()
    },
    computed: {
      ...mapState({
        checkList: state => state.contentManage.wxCheckList,
        attrs: state => state.contentManage.contentType
      }),
      baseUrl () {
        return config.baseUrl
      }
    },
    methods: {
      ...mapActions(['getWxCheckList', 'getContentTypes', 'setWxReleaseCheck']),
      async initPage () {
        this.getContentTypes()
        await this.submitSearch()
      },
      // 日期格式化
      dateFormat (date) {
        return this.$date.format(new Date(date), 'YYYY-MM-DD hh:mm:ss')
      },
      // 搜索
      async submitSearch () {
        this.tbLoading = true
        await this.getWxCheckList({
          wd: this.wd,
          attribute: this.attrId,
          auditStatus: 1,
          page: this.page,
          size: this.size
        })
        this.tbLoading = false
      },
      // 改变分页大小
      handleSizeChange (size) {
        this.size = size
        this.submitSearch()
      },
      // 通过审核
      async handlePass (id) {
        await this.$confirm('确认审核通过该条记录？')
        const res = await this.setWxReleaseCheck({
          auditId: id,
          auditStatus: 1
        })
        res.data.code === 1 && this.$message('成功')
        this.submitSearch()
      },
      // 不通过审核
      async handleNoPass () {
        const res = await this.setWxReleaseCheck({
          auditId: this.checkId,
          auditStatus: 2,
          reason: this.reason
        })
        res.data.code === 1 && this.$message.success(res.data.msgZ)
        this.submitSearch()
        this.dialogShow = false
      }
    }
  }
</script>
<style lang="scss">
  .wx_content_check{
    .el-row{margin-bottom:15px;}
    .el-table td{padding:5px 0;vertical-align:top;}
    .el-tag{margin-left:10px;height:18px;line-height:16px;}
    .newsItem{
      &{margin-top:10px;overflow:hidden;}
      .preview{float:left;width:100px;height:100px;}
      .content{margin-left:110px;}
    }
    .reason{color:#ccc;}
  }
</style>
